<template>
     
    <!-- 统计和清空 -->
    <footer class="footer">
      <!-- 统计 -->
      <span class="todo-count">合 计:<strong> {{allCount}} </strong></span>
      <!-- 清空 -->
      <button class="clear-completed" @click="clearAll">
        清空任务
      </button>
    </footer>
</template>

<script>
import EventBus from '../Utility/EventBus';  
export default {

  created() {
    // 监听父组件传过来的数据
    EventBus.$on('updateAllCount', (count) => {
     console.log('接收到父组件传过来的数据', count);
    });
  },
  props: {
    // 接收父组件传过来的数据
    allCount: {
      type: Number,
      default: 0
    }
  },
  methods: {
    // 清空任务
    clearAll() {
      this.$emit('clearAll');
    }
  }

}
</script>

<style>

</style>